package datastructure.ch03_linked.ch07_nodes;

/**
 * 双节点
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public class DoubleNode<E> {
    public E element;
    public DoubleNode<E> prev;
    public DoubleNode<E> next;

    public DoubleNode() {
    }

    public DoubleNode(E e) {
        this(null, e, null);
    }

    public DoubleNode(DoubleNode<E> prev, E element, DoubleNode<E> next) {
        this.element = element;
        this.prev = prev;
        this.next = next;
    }

    @Override
    public String toString() {
        return (prev != null ? prev.element : "NULL") + "_" + element + "_" + (next != null ? next.element : "NULL");
    }
}
